package com.github.itdachen.boot.logger;

import com.github.itdachen.boot.logger.aspect.LoggerDevAspect;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * LoggerDevAutoConfiguration
 *
 * @author 朔风
 * @date 2025-11-19 15:58
 */
@Configuration
@EnableAspectJAutoProxy
public class LoggerDevAutoConfiguration {

    /***
     * 申明一个 bean，自动装配
     * 默认生效和 dev 环境下生效， pro 环境下不生效
     *
     * @author 朔风
     * @date 2025/11/19 16:13
     * @return com.github.itdachen.boot.logger.aspect.LoggerDevAspect
     */
    @Bean
    @ConditionalOnProperty(prefix = "spring.profiles", name = "active", havingValue = "dev", matchIfMissing = true)
    public LoggerDevAspect loggerDevAspect() {
        return new LoggerDevAspect();
    }

}
